package com.web.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by Administrator on 2017/6/9 0009.
 */
@Controller
public class webAction {
    /**
     * webAction 控制web端所有页面的控制跳转。
     * @PreAuthorize 控制页面允许访问的用户权限对应数据库user表role字段ROLE_admin,ROLE_test
     * @RequestMapping value值为访问监控的多个地址，""为空。
     * @return 返回对应templates目录下页面前缀名。
     */
    @RequestMapping(value = {"","/index"})
    public String index() {
        return "index";
    }

    @RequestMapping(value = {"/login"})
    public String login() {
        return "login";
    }

    @PreAuthorize("hasAnyRole('admin','test','user')")
    @RequestMapping(value = {"/index2"})
    public String index2() {
        return "index2";
    }
}
